import Vue from 'vue'
// 引用vue-router 插件
import VueRouter from 'vue-router'

// 引用组件Home
import Home from '../views/Home.vue'

// 全局使用VueRouter
Vue.use(VueRouter)


// 路由记录
const routes = [
  {
    // url上的路由
    path: '/',
    // 路由的名称
    name: 'login',
    // 该路由下显示的文件
    component: () => import('../views/login.vue')
  },{
    // url上的路由
    path: '/home',
    // 路由的名称
    name: 'Home',
    // 该路由下显示的文件
    component: Home
  },
  {
    path: '/about',
    name: 'About',
    // 该路由下显示的文件，() => import('') 使用了懒加载模式
    component: () => import('../views/About.vue')
  },{

    path: '/mypage',
    name: 'mypage',
    // 该路由下显示的文件，() => import('') 使用了懒加载模式
    component: () => import('../views/my.vue')
  },{

    path: '/login',
    name: 'login',
    // 该路由下显示的文件，() => import('') 使用了懒加载模式
    component: () => import('../views/login.vue')
  },{
    path: '/main',
    name: 'main',
    // 该路由下显示的文件，() => import('') 使用了懒加载模式
    component: () => import('../views/main.vue'),
  
    //子路由嵌套。
    children:[
      {
        path: '/',
        name: 'user',
        component: () => import('../views/mainChildren/user.vue')
      },{
        path: '/main/user',
        name: 'user',
        component: () => import('../views/mainChildren/user.vue')
      },{
        path: '/main/charts',
        name: 'charts',
        component: () => import('../views/mainChildren/charts.vue')
      } ,{
        path:'/main/assde',
        name: 'assde',
        component: () => import('../views/mainChildren/assde.vue')
      },{
        path:'/main/hello',
        name: 'ahello',
        component: () => import('../views/mainChildren/hello.vue')
      },{
        path:'/main/what',
        name: 'what',
        component: () => import('../views/mainChildren/what.vue')
      },{
        path:'/main/whar',
        name: 'whar',
        component: () => import('../views/mainChildren/whar.vue')
      },{
        path:'/main/ces',
        name: 'ces',
        component: () => import('../views/mainChildren/ces.vue')
      }
      

        
     
      




      
    ]
  },
]

// 
const router = new VueRouter({
  // History 模式
  mode: 'history',
  // base: process.env.BASE_URL,
  routes
})
// 导出router
export default router
